package org.cuatrovientos.englishquizpello;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * 
 * @author dani
 *
 */
public class QuizTest {


	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
	}

	/**
	 * Test method for {@link org.cuatrovientos.englishquiz.Quiz#Quiz(java.lang.String)}.
	 */
	@Test
	public void testQuiz() {
		Quiz quiz = new Quiz("sample");
		int target = quiz.quizLength();
		int expected = 10;
		
		assertEquals("Initial length", target, expected);
		
	}

	/**
	 * oberynwins
	 * Test method for {@link org.cuatrovientos.englishquiz.Quiz#addQuestion(org.cuatrovientos.englishquiz.Question)}.
	 */
	@Test
	public void testAddQuestion() {
		Quiz quiz = new Quiz("sample");
		quiz.addQuestion(new Question("To be good _","in","on","at","by","at"));
		int target = quiz.quizLength();
		int expected = 11;
		
		assertEquals("Add correct", target, expected);
	}

	/**
	 * Test method for {@link org.cuatrovientos.englishquiz.Quiz#delQuestion(java.lang.String)}.
	 */
	@Test
	public void testDelQuestion() {
		Quiz quiz = new Quiz("sample");
		quiz.addQuestion(new Question("To be good _","in","on","at","by","at"));
		quiz.addQuestion(new Question("To be bad _","in","on","at","by","at"));
		quiz.addQuestion(new Question("whatever _","in","on","at","by","at"));
		
		// now we delete
		quiz.delQuestion("To be bad _");
		int target = quiz.quizLength();
		int expected = 12;
		
		assertEquals("Del is correct", target, expected);

	}

}

